package com.cam.generator.dict;

import com.cam.framework.annotation.SysDictAnno;
import com.cam.framework.crud.SysDictInterface;

@SysDictAnno(type = "gen_code_db_field_type")
public enum GenCodeDbFieldTypeDict implements SysDictInterface {
    VARCHAR("VARCHAR", "01", "varchar", true, 255, false, null),
    TEXT("TEXT", "02", "text", false, null, false, null),
    LONG_TEXT("LONGTEXT", "03", "longtext", false, null, false, null),


    /* 数字类型 */
    INT("INT", "11", "int", false, null, false, null),
    DECIMAL("DECIMAL", "12", "decimal", true, 10, true, 2),

    /* 日期类型 */
    DATE("DATE", "21", "date", false, null, false, null),
    DATETIME("DATETIME", "22", "datetime", false, null, false, null),

    /* 其他类型 */
    FOREIGN_KEY("外键", "91", "varchar", true, 64, false, null),

    ;

    private final String label;

    private final String value;

    private final String dbType;

    /*
     * 是否需要输入长度
     * */
    private final Boolean lengthFlag;

    /*
     * 默认长度
     * */
    private final Integer lengthDefault;

    /*
     * 是否需要输入小数点长度
     * */
    private final Boolean precisionFlag;

    /*
     * 默认小数点长度
     * */
    private final Integer precisionDefault;


    GenCodeDbFieldTypeDict(String label, String value, String dbType, Boolean lengthFlag, Integer lengthDefault, Boolean precisionFlag, Integer precisionDefault) {
        this.label = label;
        this.value = value;
        this.dbType = dbType;
        this.lengthFlag = lengthFlag;
        this.lengthDefault = lengthDefault;
        this.precisionFlag = precisionFlag;
        this.precisionDefault = precisionDefault;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public String getValue() {
        return value;
    }

    public String getDbType() {
        return dbType;
    }

    public Boolean getLengthFlag() {
        return lengthFlag;
    }

    public Integer getLengthDefault() {
        return lengthDefault;
    }

    public Boolean getPrecisionFlag() {
        return precisionFlag;
    }

    public Integer getPrecisionDefault() {
        return precisionDefault;
    }
}
